<template>
  <div class="demo">
    <h2 class="name">学校名称：{{ name }}</h2>
    <h2>学校地址：{{ address }}</h2>
    <button @click="sendSchoolName">发送学校名称</button>
  </div>
</template>

<script>
export default {
  name: "Student",
  data() {
    return {
      name: "重庆大学",
      address: "重庆",
    };
  },
  props: ["getSchoolName"],
  methods: {
    sendSchoolName() {
      this.getSchoolName(this.name);
    },
  },
};
</script>

<style scoped lang="less">
.demo {
  background-color: palevioletred;
  color: white;
  .name {
    color: palegreen;
  }
}
</style>
